#pragma once
#include "stdafx.h"
#include <math.h>
#include <assert.h>

struct Vector4D
{
	MY_DATATYPE x;
	MY_DATATYPE y;
	MY_DATATYPE z;
	MY_DATATYPE w;

	Vector4D(MY_DATATYPE x = 0.0,MY_DATATYPE y=0.0,MY_DATATYPE z=0.0,MY_DATATYPE w = 0.0)
	{
		this->x = x;
		this->y = y;
		this->z = z;
		this->w = w;
	}

	Vector4D(const Vector4D & v)
	{
		this->x = v.x;
		this->y = v.y;
		this->z = v.z;
		this->w = v.w;
	}

	static Vector4D crossProduct(const Vector4D & v1,const Vector4D & v2)
	{
		Vector4D result;
		return result;
	}

	static Vector4D normalize(const Vector4D & v)
	{
		MY_DATATYPE l = (MY_DATATYPE)sqrt(v.x*v.x+v.y*v.y+v.z*v.z+v.w*v.w);
		assert(abs((double)l-0.0)>=0.0001);
		Vector4D res(v.x/l,v.y/l,v.z/l,v.w/l);
		return res;
	}

	static MY_DATATYPE dotProduct(const Vector4D & v1, const Vector4D & v2)
	{
		return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z + v1.w*v2.w;
	}
};